﻿<%@ Page Language="C#" MasterPageFile="~/car-Insurance/Car_Insurance_Result_new.master"
    AutoEventWireup="true" CodeFile="ResetPassword.aspx.cs" Inherits="User_ResetPassword"
    Title="Reset Password" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script src="../includes/ValidationError.js" type="text/javascript"></script>

    <script src="../includes/ValidationEffect.js" type="text/javascript"></script>

    <div class="elements_inner_wrapper">
        <div id="contentBody">
            <table width="75%">
                <tr>
                    <td style="font-weight: bold">
                        <h3>
                            Reset Password</h3>
                    </td>
                    <td>
                        &nbsp;
                        <asp:Label ID="lblAutoKey" Visible="false" runat="server"></asp:Label>
                        <asp:Label ID="lblGUID" Visible="false" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:ValidationSummary ID="vsResetPassword" CssClass="errorSummary" HeaderText="Oops... Please complete the form"
                            runat="server" ValidationGroup="customer" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Enter New Password
                    </td>
                    <td>
                        <asp:TextBox ID="txtNewPassword" runat="server" MaxLength="20" Width="200px" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvNewPassword" validationErrorCssClass="validationError"
                            runat="server" ControlToValidate="txtNewPassword" Display="Dynamic" ErrorMessage=""
                            Text="" ValidationGroup="customer">
                        </asp:RequiredFieldValidator>
                        <%--<asp:CustomValidator ID="csvNewPassword" runat="server" ClientValidationFunction="CheckPasswordLength"
                            ControlToValidate="txtNewPassword" Display="Dynamic" ErrorMessage="Password length should be at least 6."
                            ValidationGroup="customer">*</asp:CustomValidator>--%>
                    </td>
                </tr>
                <tr>
                    <td>
                        Retype New Password
                    </td>
                    <td>
                        <asp:TextBox ID="txtRetypeNewPassword" runat="server" MaxLength="20" Width="200px"
                            TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvRetypePassword" validationErrorCssClass="validationError"
                            runat="server" ValidationGroup="customer" ErrorMessage="" Text="" Display="Dynamic"
                            ControlToValidate="txtRetypeNewPassword"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:CompareValidator ID="csvRetypePassword" runat="server" validationErrorCssClass="validationError"
                            Display="Dynamic" ValidationGroup="customer" ErrorMessage="" Text="Both password should be same."
                            ControlToValidate="txtRetypeNewPassword" ControlToCompare="txtNewPassword"></asp:CompareValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <%--<asp:ImageButton ID="btnSubmit" ImageUrl="~/images/buttons/button_setpass.gif" OnClientClick="LoadValidationErrorCss();"
                            runat="server" Text="Set Password" OnClick="btnSubmit_Click" ValidationGroup="customer" />--%>
                        <asp:Button ID="btnSubmit" CssClass="button_resetpassword" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('customer')){ this.className='button_w_processing';}"
                            runat="server" OnClick="btnSubmit_Click" ValidationGroup="customer" />
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
    </script>

</asp:Content>
